package javaNet.blocking;

import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Arrays;

/**
 * 一个线程只能同时处理一个客户端的连接
 */
public class Server {
    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket=new ServerSocket(6543);
        while (true){
            Socket client = serverSocket.accept();
            InputStream clientInputStream = client.getInputStream();
            byte[] msg=new byte[100];
            clientInputStream.read(msg);
            String s = new String(msg);
            System.out.println(s);
        }
    }
}
